From a44546ddb7893200a66df3432276005806d94d7c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Florian=20M=C3=BCllner?= Date: Tue, 13 May 2025 01:18:28 +0200 Subject: [PATCH] tools/toolbox: Support --devkit when running shell It is the modern replacement for nested mode, and does not depend on the X11 backend that is on its way out. For now keep support for --nested as a fallback, so the script keeps working on older branches. Part-of: --- tools/toolbox/run-gnome-shell.sh | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/tools/toolbox/run-gnome-shell.sh b/tools/toolbox/run-gnome-shell.sh index 349898c77..23b1186b5 100755 --- a/tools/toolbox/run-gnome-shell.sh +++ b/tools/toolbox/run-gnome-shell.sh @@ -49,6 +49,14 @@ should_run_nested() { [[ "$XDG_SESSION_TYPE" != "tty" ]] && [[ ! "$HEADLESS" ]] } +has_devkit() { + toolbox --container $TOOLBOX run gnome-shell --help | grep -q -- --devkit +} + +has_nested() { + toolbox --container $TOOLBOX run gnome-shell --help | grep -q -- --nested +} + # load defaults . $CONFIG_FILE TOOLBOX=$DEFAULT_TOOLBOX @@ -147,15 +155,25 @@ while true; do esac done +FORCE_DISPLAY=1 if should_run_nested; then - SHELL_ARGS+=( --nested ) + if has_devkit; then + SHELL_ARGS+=( --devkit ) + FORCE_DISPLAY=0 + elif has_nested; then + SHELL_ARGS+=( --nested ) + else + die Mutter has to be built with devkit or x11 support + fi else SHELL_ARGS+=( --wayland ) fi -display=toolbox-wayland-$RANDOM -SHELL_ENV+=(WAYLAND_DISPLAY=$display) -SHELL_ARGS+=(--wayland-display=$display) +if [ $FORCE_DISPLAY -gt 0 ]; then + display=toolbox-wayland-$RANDOM + SHELL_ENV+=(WAYLAND_DISPLAY=$display) + SHELL_ARGS+=(--wayland-display=$display) +fi toolbox --container $TOOLBOX run \ env "${SHELL_ENV[@]}" dbus-run-session $GDB gnome-shell "${SHELL_ARGS[@]}" -- 2.39.5